/**
  * Created by yamei on 2017/7/26.
  */
object creating_multiline_string {
  def main(args: Array[String]) {
    val foo =
      """
        |this is
        |a multiline
        |String
      """.stripMargin
    //""" """".stripMargin 格式化输出字符串对齐开头
    println(foo)
    val speech =
      """this is
        #scala code
        #Java code
      """.stripMargin('#')
    //scala 定界符默认是 | 我们可以用stripMargin('#')指定定界符
    println(speech)
    val a1 = """wuqiong
                   |xujianguo
                   |maliang""".stripMargin.replaceAll("\r\n", " ")
    //stripMargin.replace()将多行合并为一行
    println(a1)
    val b1 =
      """
        |this is known as a
        |"hellow world" is string
        |or 'herdoc' syntax.
      """.stripMargin.replaceAll("\r\n"," ")
    //在字符串加入单双引号
    println(b1)
  }

}
